﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IcsSEMCtrl.Service.Logger
{
    public class LogHelper
    {
        public static readonly ILog logInfo = LogManager.GetLogger("logInfo");
        public static readonly ILog logError = LogManager.GetLogger("logError");
        public static readonly ILog operationLog = LogManager.GetLogger("operationLog");
        public static readonly ILog materialLog = LogManager.GetLogger("materialLog");
        public static readonly ILog commandLog = LogManager.GetLogger("commandLog");
        public static readonly ILog PLCLog = LogManager.GetLogger("PLCLog");
        public static readonly ILog alarmLog = LogManager.GetLogger("alarmLog");
        public static readonly ILog ObservableLog = LogManager.GetLogger("ObservableLog");
        public static void loggerInfo(string infoMessage)
        {
            if (logInfo.IsInfoEnabled)
            {
                logInfo.Info(infoMessage);
            }
        }

        public static void loggerError(string errorMessage, Exception ex)
        {
            if (logError.IsErrorEnabled)
            {
                logError.Error(errorMessage, ex);
            }
        }

        public static void operationLogger(string operationMessage)
        {
            if (operationLog.IsInfoEnabled)
            {
                operationLog.Info(operationMessage);
            }
        }

        public static void materialLogger(string materialLogMessage)
        {
            if (materialLog.IsInfoEnabled)
            {
                materialLog.Info(materialLogMessage);
            }
        }

        public static void commandLogger(string commandLogMessage)
        {
            if (commandLog.IsInfoEnabled)
            {
                commandLog.Info(commandLogMessage);
            }
        }

        public static void PLCLogger(string PLCLogMessage)
        {
            if (PLCLog.IsInfoEnabled)
            {
                PLCLog.Info(PLCLogMessage);
            }
        }


        public static void ObservableLogger(string ObservableLogMessage)
        {
            if (ObservableLog.IsInfoEnabled)
            {
                ObservableLog.Info(ObservableLogMessage);
            }
        }

        public static void alarmLogger(string alarmLogMessage)
        {
            if (alarmLog.IsInfoEnabled)
            {
                alarmLog.Info(alarmLogMessage);
            }
        }
    }
}
